]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/network: Fix error notification for wireguard
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 5 Aug 2022 21:21:21 +0000 (23:21 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 7 Aug 2022 20:41:09 +0000 (22:41 +0200)
The function is a handler for the `notify::state` handler, so
the state and reason parameters used in the checks are always
undefined.

In addition, `DEACTIVATED` is not (just) a failure state. We
clearly don't want to complain about a failed connection when
the change happened on request of the user.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2406>

js/ui/status/network.js

index c35f4bc51ad7fe847deb46b8b7d9f69a2444708b..c31797a4ad04ee5e99cb98948df4473d4899e9f7 100644 (file)
@@ -1477,9 +1477,13 @@ var NMWireguardItem = class extends NMConnectionItem {
         }
     }
 
-    _connectionStateChanged(ac, newstate, reason) {
-        if (newstate === NM.ActiveConnectionState.DEACTIVATED &&
-            reason !== NM.ActiveConnectionStateReason.NO_SECRETS)
+    _connectionStateChanged() {
+        const state = this._activeConnection?.get_state();
+        const reason = this._activeConnection?.get_state_reason();
+
+        if (state === NM.ActiveConnectionState.DEACTIVATED &&
+            reason !== NM.ActiveConnectionStateReason.NO_SECRETS &&
+            reason !== NM.ActiveConnectionStateReason.USER_DISCONNECTED)
             this.emit('activation-failed');
 
         this.emit('icon-changed');